package printwriter;

import java.io.*;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : PrintWriterDemo
 * @Author : 54061
 * @Date: 2022/2/15 10:14
 */
/*
打印流一次一行复制文本文件

PrintWriter 带有自动刷新和自动换行
创建PrintWriter对象想要自动刷新又要自动换行 : 打开自动刷新开关和调用println方法进行内容输出
PrintWriter(OutputStream out,boolean autoFlush)
PrintWriter(Writer out,boolean autoFlush)

 */
public class PrintWriterDemo {
    public static void main(String[] args) throws IOException {
        //创建流
        BufferedReader br = new BufferedReader(new FileReader("T_Day20\\aaa\\出师表.txt"));
        PrintWriter pw = new PrintWriter(new FileWriter("T_Day21\\aaa\\出师表.txt"), true);

        //循环读写
        String line;
        while((line = br.readLine()) != null){
//            pw.write(line);
//            pw.write("\r\n");
            pw.println(line);
        }

        //关流
        br.close();
        pw.close();
    }
}
